package cn.com.lms.business.course.persistence.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "bnz_course_info", schema = "bnzj")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
public class FbCourseInfo {
    private long id;
    @Schema(description = "课程标题")
    private String title;
    @Schema(description = "课程类型")
    private long courseType;
    @Schema(description = "推荐值")
    private Integer recommendNum;
    @Schema(description = "分数")
    private int score;
    @Schema(description = "学分")
    private int credit;
    @Schema(description = "简介")
    private String remark;
    @Schema(description = "封面图片")
    private String pictureUrl;
    private String courseFile;
    @Schema(description = "目录id")
    private long categoryId;
    @Schema(description = "课程时间")
    private int courseTime;
    @Schema(description = "直播开始时间（编辑时定的开播时间）")
    private Date liveStartTime;
    @Schema(description = "直播真实开始时间")
    private Date liveRealStartTime;
    @Schema(description = "直播课程状态：默认0未开始；1直播中；2已结束；3录制完成；4转码完成")
    private int liveStatus;
    @Schema(description = "直播人")
    private Long livePersonId;
    private String isDelete;
    private String isDownload;
    private String isOver;
    @Schema(description = "创建人id")
    private long creator;
    private Timestamp createTime;
    private Long modifyBy;
    @Schema(description = "修改时间")
    private Timestamp modifyTime;
    @Schema(description = "创建人名称")
    private String creatorName;
    private String modifyName;

    @Schema(description = "学生数")
    private Integer stuNum;
    @Schema(description = "课程类型名称")
    private String courseTypeName;
    @Schema(description = "直播人名称")
    private String cname;
    @Schema(description = "直播观看人数")
    private String viewersCount;
    @Schema(description = "是否加入学习计划")
    private Boolean isJoin;

    public String getIsOver() {
        return isOver;
    }

    public void setIsOver(String isOver) {
        this.isOver = isOver;
    }

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "title")
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "course_type")
    public long getCourseType() {
        return courseType;
    }

    public void setCourseType(long courseType) {
        this.courseType = courseType;
    }

    @Basic
    @Column(name = "recommend_num")
    public Integer getRecommendNum() {
        return recommendNum;
    }

    public void setRecommendNum(Integer recommendNum) {
        this.recommendNum = recommendNum;
    }

    @Basic
    @Column(name = "score")
    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Basic
    @Column(name = "credit")
    public int getCredit() {
        return credit;
    }

    public void setCredit(int credit) {
        this.credit = credit;
    }

    @Basic
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Basic
    @Column(name = "picture_url")
    public String getPictureUrl() {
        return pictureUrl;
    }

    public void setPictureUrl(String pictureUrl) {
        this.pictureUrl = pictureUrl;
    }

    @Basic
    @Column(name = "course_file")
    public String getCourseFile() {
        return courseFile;
    }

    public void setCourseFile(String courseFile) {
        this.courseFile = courseFile;
    }

    @Basic
    @Column(name = "category_id")
    public long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(long categoryId) {
        this.categoryId = categoryId;
    }

    @Basic
    @Column(name = "course_time")
    public int getCourseTime() {
        return courseTime;
    }

    public void setCourseTime(int courseTime) {
        this.courseTime = courseTime;
    }

    @Basic
    @Column(name = "live_start_time")
    public Date getLiveStartTime() {
        return liveStartTime;
    }

    public void setLiveStartTime(Date liveStartTime) {
        this.liveStartTime = liveStartTime;
    }

    @Basic
    @Column(name = "live_real_start_time")
    public Date getLiveRealStartTime() {
        return liveRealStartTime;
    }

    public void setLiveRealStartTime(Date liveRealStartTime) {
        this.liveRealStartTime = liveRealStartTime;
    }

    @Basic
    @Column(name = "live_status")
    public int getLiveStatus() {
        return liveStatus;
    }

    public void setLiveStatus(int liveStatus) {
        this.liveStatus = liveStatus;
    }

    @Basic
    @Column(name = "live_person_id")
    public Long getLivePersonId() {
        return livePersonId;
    }

    public void setLivePersonId(Long livePersonId) {
        this.livePersonId = livePersonId;
    }

    @Basic
    @Column(name = "is_delete")
    public String getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(String isDelete) {
        this.isDelete = isDelete;
    }

    @Basic
    @Column(name = "is_download")
    public String getIsDownload() {
        return isDownload;
    }

    public void setIsDownload(String isDownload) {
        this.isDownload = isDownload;
    }

    @Basic
    @Column(name = "creator")
    public long getCreator() {
        return creator;
    }

    public void setCreator(long creator) {
        this.creator = creator;
    }

    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "modify_by")
    public Long getModifyBy() {
        return modifyBy;
    }

    public void setModifyBy(Long modifyBy) {
        this.modifyBy = modifyBy;
    }

    @Basic
    @Column(name = "modify_time")
    public Timestamp getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Timestamp modifyTime) {
        this.modifyTime = modifyTime;
    }

    @Basic
    @Column(name = "creator_name")
    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    @Basic
    @Column(name = "modify_name")
    public String getModifyName() {
        return modifyName;
    }

    public void setModifyName(String modifyName) {
        this.modifyName = modifyName;
    }

    @Basic
    @Column(name = "viewers_count")
    public String getViewersCount() {
        return viewersCount;
    }

    public void setViewersCount(String viewersCount) {
        this.viewersCount = viewersCount;
    }

    @Transient
    public Integer getStuNum() {
        return stuNum;
    }

    public void setStuNum(Integer stuNum) {
        this.stuNum = stuNum;
    }

    @Transient
    public String getCourseTypeName() {
        return courseTypeName;
    }

    public void setCourseTypeName(String courseTypeName) {
        this.courseTypeName = courseTypeName;
    }

    @Transient
    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    @Transient
    public Boolean getJoin() {
        return isJoin;
    }

    public void setJoin(Integer join) {
        isJoin = join > 0;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FbCourseInfo that = (FbCourseInfo) o;
        return id == that.id &&
                courseType == that.courseType &&
                score == that.score &&
                credit == that.credit &&
                categoryId == that.categoryId &&
                courseTime == that.courseTime &&
                liveStatus == that.liveStatus &&
                creator == that.creator &&
                Objects.equals(title, that.title) &&
                Objects.equals(recommendNum, that.recommendNum) &&
                Objects.equals(remark, that.remark) &&
                Objects.equals(pictureUrl, that.pictureUrl) &&
                Objects.equals(courseFile, that.courseFile) &&
                Objects.equals(liveStartTime, that.liveStartTime) &&
                Objects.equals(liveRealStartTime, that.liveRealStartTime) &&
                Objects.equals(livePersonId, that.livePersonId) &&
                Objects.equals(isDelete, that.isDelete) &&
                Objects.equals(isDownload, that.isDownload) &&
                Objects.equals(isOver, that.isOver) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(modifyBy, that.modifyBy) &&
                Objects.equals(modifyTime, that.modifyTime) &&
                Objects.equals(creatorName, that.creatorName) &&
                Objects.equals(modifyName, that.modifyName) &&
                Objects.equals(stuNum, that.stuNum) &&
                Objects.equals(courseTypeName, that.courseTypeName) &&
                Objects.equals(cname, that.cname) &&
                Objects.equals(viewersCount, that.viewersCount) &&
                Objects.equals(isJoin, that.isJoin);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, title, courseType, recommendNum, score, credit, remark, pictureUrl, courseFile, categoryId, courseTime, liveStartTime, liveRealStartTime, liveStatus, livePersonId, isDelete, isDownload, isOver, creator, createTime, modifyBy, modifyTime, creatorName, modifyName, stuNum, courseTypeName, cname, viewersCount, isJoin);
    }
}
